#ifndef MEDIATOR_H
#define MEDIATOR_H

#include "analyser.h"
#include "player.h"
#include "playlist.h"
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtCore/QMutex>

class Analyser;
class Player;
class Playlist;

enum available {PLAYING, PAUSED, STOPPED};

class Mediator : public QObject
{
	Q_OBJECT

public :
	Mediator();
	~Mediator();
	int itemType(int);

public slots :
	void addItem(QString);
	void delItem(int);
	void clearItems(void);
	void loadPlaylist(QString);
	void savaPlaylist(QString);

	void play(void);
	void play(int);
	void pause(void);
	void stop(void);
	void prev(void);
	void next(void);

	void setIndex(int);
	void setSpeed(int);
	void setVolume(int);
	void setPosition(unsigned int);
	void setPosition(int, int);

	QString getItemTag(int, int);

private slots:
	void whileAnalysed(unsigned int *, QString, bool);
	void whileTagsGot(QString, QString, QString);

signals :
	void analysing(unsigned int);
	void readyToAnalyse(unsigned int);
	void analysed(void);
	void readyToPlay(unsigned int, QString);
	void playing(unsigned int);
	void paused(void);
	void stopped(void);

	void itemLoaded(QString);
	void tagsSaved(void);

	//void debuginfo(QString);

private :
	available state;

	Analyser *analyser;
	Player   *player;
	Playlist *playlist;
};

#endif
